﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SES.CMS.BL;
using SES.CMS.DO;

namespace SES.CMS.AdminCP.PageUC
{
    public partial class ucListProductCategory : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            grvLoaiSanPhamDataSource();
        }

        protected void grvLoaiSanPhamDataSource()
        {
            grvLoaiSanPham.DataSource = new cmsLoaiSanPhamBL().SelectAll(0);
            grvLoaiSanPham.DataBind();
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx?Page=ProductCategory");
        }

        protected void grvLoaiSanPham_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {

        }

        protected void grvLoaiSanPham_SelectedIndexChanged(object sender, EventArgs e)
        {
            int ProductID = int.Parse(grvLoaiSanPham.DataKeys[grvLoaiSanPham.SelectedIndex].Value.ToString());
            Response.Redirect("Default.aspx?Page=ProductCategory&PID="+ProductID);
        }

        protected void grvLoaiSanPham_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            grvLoaiSanPham.PageIndex = e.NewPageIndex;
            grvLoaiSanPhamDataSource();
        }
    }
}